package com.csun.dsms.comment.core.support;

import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Locale;

/**
 * @author chisj chisj@foxmail.com
 * @version 1.0.0
 * @date 2021-09-02 15:47
 * @description: TODO
 */
@Component
public class CsunMessageSource {

    @Resource
    private MessageSource messageSource;

    public String getMessage(String code, Object[] param) {

        Locale locale = LocaleContextHolder.getLocale();

        return messageSource.getMessage(code, param, LocaleContextHolder.getLocale());
    }
}
